#include "RequestHeader.h"
#include <header.h>


/* 初始化函数 */
RequestHeader* createRequestHeader(unsigned short command, int filesize, int offset, unsigned int argcnt) {
    RequestHeader* header = (RequestHeader*)malloc(sizeof(RequestHeader));
    if (header == NULL) {
        perror("Failed to allocate memory for RequestHeader");
        return NULL;
    }

    header->command = command;
    header->filesize = filesize;
    header->offset = offset;
    header->argcnt = argcnt;

    return header;
}

/* 销毁函数 */
void freeRequestHeader(RequestHeader* header) {
    if (header != NULL) {
        free(header);
    }
}